NUnit Test Generator
Creating Templates
Using NUnit Test Generator > Creating Templates

Creating your own template is easy.  You can Clone an existing template or create one from scratch.  It does not have to be a C# or VB.NET template, you can create html, xml, or other file type you can think of.  Basically a template contains static text and some tags that are simply searched and replaced during processing.  See the tags topic for the tags available.  There are three different scopes for the tags:

Here is a simple example of a template to create an HTML form based on the properties of a class.

<!-- Submit Form for KS_CLASSNAME -->
<form>
KS_BEGINPROPERTIES
KS_PROPERTYENGLISHNAME: <input type="text" name="KS_PROPERTYNAME"><br>
KS_ENDPROPERTIES
</form>

The KS_CLASSNAME is a global variable that will be replaced by the name of the class.

In between the KS_BEGINPROPERTIES and KS_ENDPROPERTIES tags are other tags.  For each property in the class, there will be a line output with the tags.  If we would have the class Customer:

public class Customer
{
 public string FirstName { get; set; }
 public string LastName { get; set; }
}

 

It would be output as this:

<!-- Submit Form for Customer -->
<form>
First Name: <input type="text" name="FirstName"><br>
Last Name: <input type="text" name="LastName"><br>
</form>